|
|
|
|
|
|
|
it is natural to ask, "Why should I write complex graphics programs in Visual Basic? Wouldn't it be better to write complex applications in C? Or at least to build graphic algorithms in C and make them available to Visual Basic programs through libraries?" |
|
|
|
|
|
|
|
|
Writing graphics programs in Visual Basic makes sense for several reasons. |
|
|
|
|
|
|
|
|
First, Visual Basic provides a powerful environment for developing graphical user interfaces. Building a complete application in C or C++ is much more difficult and dangerous. If your program does not handle all the details of Windows programming correctly, your application, the development environment, and possibly all of Windows will come crashing down around your ears. |
|
|
|
|
|
|
|
|
Second, building a C library for use by Visual Basic involves many of the same dangers as writing a Windows application in C. While the mechanics are simple, the details can be tricky. If your library and the Visual Basic program do not cooperate in just the right way, you will again crash your program, probably the Visual Basic environment, and maybe Windows as well. |
|
|
|
|
|
|
|
|
Third, many graphics algorithms are efficient enough that they give good performance even in a slower language like Visual Basic. With personal computers increasing in power every year, many graphics techniques give perfectly acceptable results. You might be able to make some algorithms run a little faster using a C library, but the Visual Basic version is fast enough in most cases. |
|
|
|
|
|
|
|
|
Fourth, if Visual Basic was your first programming language, there is no need for you to wait until you have mastered Pascal or C before you study graphic algorithms. While some techniques are a bit easier to handle in other languages, others are much harder. Using Visual Basic will also save you the expense of buying a new compiler. |
|
|
|
|
|
|
|
|
Finally, by writing graphic applications in any programming language, you will learn more about graphic programming in general. As you study the example programs, you will learn techniques that you can use in other applications. Once you have mastered a graphic technique in Visual Basic, it will be much easier for you to reimplement it in Pascal or C if you find it absolutely necessary. |
|
|
|
|
|
|
|
|
Table I.1 lists the contents of the CD-ROM that accompanies this book. |
|
|
|
|
| Table I.1 CD-ROM Contents | | DIRECTORY | CONTENTS | | Src | Source code and data files for most of the graphic techniques discussed in the book | | Pictures | Pictures you can use with many of the example programs | | Images | Images generated by the programs | | Figs | Color images of many of the figures printed in this book | | OldSrc | Source code for the example programs from the book's first edition |
|
|
|